package com.pachong.frameworkdemo.module1;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;


import com.pachong.frameworkdemo.R;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Zoi.
 * E-mail：KyluZoi@gmail.com
 * 2016/6/27
 */
public class MultiDemoFragment extends Fragment{
    @Bind(R.id.tv_demo)
    TextView tvDemo;
    String content;
    View mContentView=null;

    public static MultiDemoFragment newInstance(String content) {
        Bundle args = new Bundle();
        MultiDemoFragment fragment = new MultiDemoFragment();
        args.putString("content",content);
        fragment.setArguments(args);
        return fragment;
    }


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mContentView=inflater.from(getContext()).inflate(R.layout.frg_multi_demo,null);
        initView(mContentView);
        return mContentView;
    }

    protected void initView(View contentView) {
        ButterKnife.bind(this, contentView);
        if(getArguments()!=null)
        {
            content=getArguments().getString("content");
        }
        tvDemo.setText(content);
    }
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }
}
